package robotia;

import javax.vecmath.Vector3d;
import simbad.sim.Agent;
import simbad.sim.RangeSensorBelt;
import simbad.sim.RobotFactory;

public class NewClassRobot extends Agent {

    RangeSensorBelt bumpers;

    public NewClassRobot(Vector3d position, String name) {
        super(position, name);
        bumpers = RobotFactory.addBumperBeltSensor(this, 8);
    }

    @Override
    public void performBehavior() {
        //every 20 frames
        if (getCounter() % 20 == 0) {
            // print each bumper state
            for (int i = 0; i < bumpers.getNumSensors(); i++) {
                double angle = bumpers.getSensorAngle(i);
                boolean hit = bumpers.hasHit(i);
                System.out.println("Bumpers at angle " + angle
                        + " has hit something:" + hit);
            }
        }
    }
}
